
$(document).ready(function () {

    var navBar = {
        backIcon: $('.mask-menu-content .back-icon'),
        menuIcon: $('.top-bar .menu-icon'),
        menuItem: $('.nav-list li'),
        mask: $('#mask'),
        clickMenuItem: function () {
            this.menuItem.off('click').on('click', function () {
                $(this).addClass('cur').siblings().removeClass('cur')
            })
        },
        clickBackIcon: function () {
            var that = this;
            this.backIcon.off('click').on('click', function () {
                that.mask.hide();
            })
        },
        clickMenuIcon: function () {
            var that = this;
            this.menuIcon.off('click').on('click', function () {
                that.mask.show();
            })
        },
        init: function () {
            this.clickMenuItem();
            this.clickBackIcon();
            this.clickMenuIcon();
        }
    }

    var bannerSwiper = {
        init: function () {
            var swiper = new Swiper(".banner-swiper", {
                autoplay: true,
                loop: true
            });
        }
    }

    var objectDisplaySwiper = {
        swiperSlide: $('.object-display-swiper').find('.swiper-slide'),
        clickFun: function () {
            this.swiperSlide.off('click').on('click', function () {
                // location.href = 'objdisplay.html';
            })
        },
        initSwiper: function () {
            var swiper = new Swiper(".object-display-swiper", {
                loolp: true,
                slidesPerView: 4,
                spaceBetween: 36,
                slidesOffsetBefore: 60,
                observer: true,//修改swiper自己或子元素时，自动初始化swiper
                observeParents: true,//修改swiper的父元素时，自动初始化swiper
                touchRatio: 1,                   //解决滑动卡顿
                longSwipesRatio: 0.1,
                //如果触摸距离小于该值滑块不会被拖动
                followFinger: false,
                grabCursor: true,
                navigation: {
                    nextEl: ".swiper-button-next",
                    prevEl: ".swiper-button-prev",
                },
            });

        },
        init: function () {
            this.clickFun();
            this.initSwiper();
        }
    }

    var SocialBusinessswiper = new Swiper(".SocialBusinessswiper", {
        // 开启自动轮播
        autoplay: {
            delay: 3000,
            stopOnLastSlide: false,
            disableOnInteraction: true,
        },
        loop: true,
        pagination: {

            el: ".swiper-pagination4",
        },
    });
    // page init
    navBar.init();
    bannerSwiper.init();
    objectDisplaySwiper.init();
    // ReaLestateJust.init();
    SocialBusinessswiper.init()

    $(".celltitle ul li h2").click(function () {
        $(this).addClass("active").parent().siblings().children().removeClass("active");
        var index = $(this).parent().index();
        $(".lists").eq(index).show().siblings(".lists").hide();
    });

    $("input[type='radio']").click(function () {

        $(this).parent().addClass("label-active").siblings().removeClass("label-active");
    })


});


